Chris Pollett >Old Classes >
CS151

( Print View )

Student Corner:
  [Grades Sec5]

  [Submit Sec5]

  [Email List Sec5]

  [
Lecture Notes]

Course Info:
  [Texts & Links]
  [Topics]
  [Grading]
  [HW Info]
  [Exam Info]
  [Regrades]
  [Honesty]
  [Additional Policies]
  [Announcements]

HW Assignments:
  [Hw1]  [Hw2]  [Hw3]
  [Hw4]  [Hw5]

Practice Exams:
  [Mid1]  [Mid2]  [Final]

                           












HW#3 --- last modified March 02 2019 21:22:37..

Solution set.

Due date: Oct 26

Files to be submitted:
  Hw3.zip

Purpose: To practice coming up with contracts for interfaces and abstract classes. To learn how to use JUnit. To gains experience with the factory, iterator, and strategy patterns.

Specification:

For this homework set we are going to work with the animation of sorting algorithms case study in the book which starts on page 284. I would like you to come up with contracts for the SortAlgorithm abstract class and the SortDisplay interface using the notation we discussed in class for describing precondition and postconditions within javadoc comments. For each implementation of SortAlgorithm and SortDisplay in the book you should add to the code Java assertions to guarantee these preconditions and postconditions. Then I would like you to write at least four test cases in a class SortTestCase which extends TestCase from JUnit that could be used to test the BubbleSortAlgorithm and QuickSortAlgorithm. Finally, I would like you to come up with your own implementation of SortDisplay which is different from the HSortDisplay and VSortDisplay in the book and which is as cool as possible. (1 bonus point for being especially cool). Submit all of your code in Hw3.zip. You should have a build.xml so that when your file is unzipped `ant runTests' builds and runs your tests and `ant runDisplay' builds and and runs your SortDisplay implementation.

Point Breakdown

Departmental coding guidelines for Java followed 1pt
Contracts for SortDisplay and SortAlgorithm (1pt each) 2pts
Assertions as described for each implementation 2pts
Test cases (.5pts each) 2pts
Your implementation of SortDisplay 2pts
build.xml works as described 1pt
Total10pts